﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using Biblioteca.Utils;


namespace SERIX
{
    public partial class MedidasIndicadoresRME : System.Web.UI.Page
    {
        public static DataTable ObterDadosGrid()
        {
            return SERIX.Classes.util.ObterTabela("IDT_IND;IDT_TPO_MED;DSC_TPO_MED;VALOR",
                "1;1;Tipo de Medida 1;1000,00",
                "1;2;Tipo de Medida 2;2000,00",
                "1;3;Tipo de Medida 3;3000,00",
                "1;4;Tipo de Medida 4;4000,00");
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
            }
        }

        int i = 0;
        protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string IDT1 = ((DataRowView)e.Row.DataItem).Row["IDT_IND"].ToString();
                string IDT2 = ((DataRowView)e.Row.DataItem).Row["IDT_TPO_MED"].ToString();
                //Se tiver permissao de Manutenção
                if (i % 2 == 0)
                {
                    ((HyperLink)e.Row.Cells[gridView.Columns.Count - 1].Controls[1]).NavigateUrl = "ValoresOrganizacoes.aspx?OP=R&idt=" + Server.UrlEncode(Criptografia.Criptografar(string.Format("{0};{1}", IDT1, IDT2)) + "&ABA=0");
                }
                else
                {
                    ((HyperLink)e.Row.Cells[gridView.Columns.Count - 1].Controls[1]).NavigateUrl = "ValoresBeneficiarios.aspx?OP=R&idt=" + Server.UrlEncode(Criptografia.Criptografar(string.Format("{0};{1}", IDT1, IDT2)) + "&ABA=0");
                }
                i++;
            }
        }
    }
}
